package com.itany.corejava.code06_数组;

/**
 * @author 石小俊
 * @date 2023年04月12日 14:15
 */
public class Test01_基本用法 {

    public static void main(String[] args) {
//        getValue();
        getLength();
    }

    public static void defined(){
        // 方式一
        int[] nums = new int[5];
        // 方式二
        int nums2[] = new int[5];
        // 方式三
        String[] names = new String[]{"admin","jack","tom","lily"};
        // 简写方式
        String[] hobbies = {"吃饭","睡觉","打豆豆"};
    }

    public static void setValue(){
        // 方式一
        int[] nums = new int[5];
        // 方式二
        int nums2[] = new int[5];
        // 方式三
        String[] names = new String[]{"admin","jack","tom","lily"};
        // 简写方式
        String[] hobbies = {"吃饭","睡觉","打豆豆"};
        nums[0] = 1;
        nums2[1] = 2;
        names[1] = "李白";
        hobbies[2] = "学Java";
    }

    public static void getValue(){
        int[] nums = new int[5];
        double[] ds = new double[5];
        char[] cs = new char[5];
        boolean[] bs = new boolean[5];
        String[] names = new String[5];

        nums[0] = 1;
        ds[0] = 3.14;
        cs[0] = 'a';
        bs[0] = true;
        names[0] = "李白";

        System.out.println(nums[0]);
        System.out.println(ds[0]);
        System.out.println(cs[0]);
        System.out.println(bs[0]);
        System.out.println(names[0]);
    }

    public static void getLength(){
        int[] nums = new int[5];
        String[] names = {"admin","jack","tom"};
        System.out.println(nums.length);
        System.out.println(names.length);
    }

}
